NestJS uses path-to-regexp under Express. Wildcards match any segment using * and optional params are declared with a trailing ?. Wildcard routes must be declared after specific routes because NestJS matches routes in declaration order on Express. Fastify uses a radix tree that prefers static segments over parametric ones.
Declare specific literal routes before wildcard param routes — NestJS matches in declaration order on Express.
Fastify uses a radix tree that automatically prefers static routes over parametric ones.
@Get('*') is a catch-all and should always be the last route in a controller.
Optional params with ? make the segment optional — the param value is undefined when absent.
Always test wildcard behavior on both Express and Fastify if you plan to switch platforms.